package com.ruoyi.project.cms.content.service;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.cms.content.domain.CMSContent;
import com.ruoyi.project.cms.content.mapper.CMSContentMapper;
import com.ruoyi.project.cms.type.domain.CMSType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CMSContentServiceImpl implements ICMSContentService {
    @Autowired
    private CMSContentMapper cmsContentMapper;

    /**
     * 查询公告集合
     * @param cmsContent 公告信息
     * @return
     */
    @Override
    public List<CMSContent> selectCmsContentList(CMSContent cmsContent) {
        return cmsContentMapper.selectContentList(cmsContent);
    }

    /**
     * 新增公告
     * @param cmsContent
     * @return
     */
    @Override
    public int insertCMSContent(CMSContent cmsContent) {
        return cmsContentMapper.insertContent(cmsContent);
    }

    /**
     * 删除公告
     * @param ids
     * @return
     */
    @Override
    public int deleteCMSContentByIds(String ids) {
        Long[] typeIds = Convert.toLongArray(ids);
        return cmsContentMapper.deleteContentByIds(typeIds);
    }

    /**
     * 回显公告
     * @param contentId
     * @return
     */
    @Override
    public CMSContent selectCMSContentById(Long contentId) {
        return cmsContentMapper.selectCmsContentById(contentId);
    }

    /**
     * 保存修改公告
     * @param cmsContent
     * @return
     */
    @Override
    public int updateCMSContent(CMSContent cmsContent) {
        return cmsContentMapper.updateCMSContent(cmsContent);
    }
}
